Extract secondary action hooks and components from MoneyReportHeader#87361
Conversation
…port-header-actions
…portPrimaryAction
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
a1ee5b8 to
d7841e4
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20ffd04e53
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
bf99903 to
a24ee65
Compare
|
Sorry for the recurrent review comments ... the changes are quite big so it's not easy to tackle in one go 😆 |
…port-header-actions # Conflicts: # src/components/MoneyReportHeader.tsx
|
@abzokhattab I think i resolved all the comments 😮💨 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-04-13.at.23.23.09.movAndroid: mWeb ChromeScreen.Recording.2026-04-13.at.23.29.37.moviOS: HybridAppScreen.Recording.2026-04-13.at.23.25.50.moviOS: mWeb SafariScreen.Recording.2026-04-13.at.23.28.05.movMacOS: Chrome / SafariScreen.Recording.2026-04-13.at.23.17.58.mov |
… to useLifecycleActions
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.60-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a pure internal refactoring that extracts |
|
Deploy Blocker ##88098 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.3.60-22 🚀
|
Explanation of Change
MoneyReportHeader had grown to ~2448 lines, mixing rendering logic with business logic for hold menus, primary actions, expense actions, and selection mode. This PR extracts that logic into focused hooks and components:
useReportPrimaryAction— replaces the inline primary action derivation; removes animation knowledge fromgetReportPrimaryActionwhich now returns a plain valueuseExpenseActions— owns all secondary expense action callbacks (hold, unhold, etc.); receivesisReportInSearchas a prop instead of hardcodingfalseuseTransactionThreadReport— fetches the transaction thread report internally viauseOnyxinstead of requiring callers to pass it downActionsBar— renders sub-components directly; no longer accepts ReactNode props, eliminating the pattern that forced parent re-rendersMoneyReportHeaderHoldMenu— extracted with an early-return guard so the heavy hold menu tree is never evaluated unless neededisSelectionModePaymentRef, unusedselectedTransactionIDs, and theclearSelectedTransactionscallback that was duplicated in the wrong scopeThe net result is MoneyReportHeader going from ~2448 lines to ~298 lines, with action logic owned by the hooks that have the right data access.
Fixed Issues
$ #87937
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov